Skip to content

improvement(build): add -Dlibrary_name for change name *.dll, *.so, *… #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yiv1
Copy link

@yiv1 yiv1 commented Jun 1, 2025

Second part resolves #147

This is a prototype. Maybe I did something wrong. Maybe it's worth adding the same functionality to .luajit and .luau

Copy link
Collaborator

@robbielyman robbielyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the changes to library_name I mentioned.

@@ -16,6 +16,7 @@ pub fn build(b: *Build) void {
const optimize = b.standardOptimizeOption(.{});

const lang = b.option(Language, "lang", "Lua language version to build") orelse .lua54;
const library_name = b.option([]const u8, "library_name", "Library name for lua linking, default is `lua`") orelse null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the default is lua, why not do orelse "lua"? that would allow you to treat library_name as having type []const u8 instead of ?[]const u8.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair question. I think I tried that and got a compilation error. Maybe you'll come up with a better solution.

@@ -31,6 +32,7 @@ pub fn build(b: *Build) void {
// Expose build configuration to the ziglua module
const config = b.addOptions();
config.addOption(Language, "lang", lang);
config.addOption(?[]const u8, "library_name", library_name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary? i'm not opposed to it—i just don't see what role this line plays.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope I understood correctly and this is for the output zig build --help

@yiv1
Copy link
Author

yiv1 commented Jun 22, 2025

I'd like to see the changes to library_name I mentioned.

my experience of zig is very weak. i see a more correct approach in creating a structure to pass to .configure() all three .lua .luajit .luau

please feel free to change the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lack of official documentation for creating shared modules
2 participants